<template>
  <div class="dashboard-container">
    <component :is="currentRole" v-if="show" />
  </div>
</template>

<script>
import adminDashboard from './admin'

export default {
  name: 'Dashboard',
  components: { adminDashboard },
  data() {
    return {
      currentRole: 'adminDashboard',
      show: false
    }
  },
  created() {
    const Array = this.$store.state.user.roles
    Array.forEach(item => {
      if (item === 'admin') {
        this.show = true
      } else if (item === 'admin1') {
        this.show = true
      } else if (item === 'wms') {
        this.show = true
      } else {
        this.show = false
      }
    })
  }
}
</script>
